﻿<%@ Page Language="C#" enableViewStateMac="false" %>
<%
  string strUserIP = Request.UserHostAddress;
%>
<html>
<head>

<title>用户登录</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<style type="text/css">
<!--

BODY {
  BACKGROUND-POSITION: left top; 
  BACKGROUND-COLOR: #ffffff; images: fixed
}

td {
  font-size:9pt;
}

.TextBorder {
    color:              #333333;
    width:              120px;
    font-size:          9pt;
    background-color:   #ffffff;
    border:             1px solid #0080FF;
}

.button {
  BORDER-RIGHT: #7b9ebd 1px solid;
  PADDING-RIGHT: 2px;
  BORDER-TOP:#7b9ebd 1px solid;
  PADDING-LEFT: 2px;
  FONT-SIZE: 12px; FILTER:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#ffffff, EndColorStr=#cecfde);
  BORDER-LEFT: #7b9ebd 1px solid;
  CURSOR: hand; COLOR: black;
  PADDING-TOP: 2px;
  BORDER-BOTTOM: #7b9ebd 1px solid
}
-->
</style>

<link rel="stylesheet" type="text/css" href="../../../WebPlugin/jquery-easyui/themes/default/easyui.css"/>
<link rel="stylesheet" type="text/css" href="../../../WebPlugin/jquery-easyui/themes/icon.css"/>
<script type="text/javascript" src="../../../WebPlugin/jquery-easyui/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="../../../WebPlugin/jquery-easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../../../WebPlugin/jquery-easyui/locale/easyui-lang-zh_CN.js"></script>
<script language="javascript" type="text/javascript">
function doKeyDown(event) {
var evt = event ? event : (window.event ? window.event : null); 

    var keyCode = evt.keyCode;
    var src = evt.srcElement;
    var edt1 = document.getElementById("txtUserName");
    var edt2 = document.getElementById("txtUserPWD");
    var btn = document.getElementById("Submit");

    switch (evt.keyCode) {
        case 27:    // ESC
            edt1.value = "";
            edt2.value = "";
            return false;
            break;

        case 38:    // UP
            if (src == edt1) {
                btn.focus();
            }
            else if (src == edt2) {
                edt1.focus();
            }
            else if (src == btn) {
                edt2.focus();
            }
            break;

        case 13:    // Enter
            break;
        case 40:    // Down
            break;
        case 108:   // Enter(小键盘上)
            break;
           
    }
    return true;
}
//异步请求
function requestAjax(requestUrl, requestData, callback,errcallback) {
    $.ajax({
        type: "POST",
        url: requestUrl,
        data: requestData,
        success: function(msg) {
            var retobject = eval('(' + msg + ')');
            if (retobject.ret == 0) {//后台操作成功
                if (callback)
                    callback(retobject.data);
            }else{
                if (errcallback)
                    errcallback();
            }
            if (retobject.msg != '') {
                //alert("结果: " + retobject.msg);
                $.messager.alert('提示', "结果: " + retobject.msg, 'info');
            }
        }
    });
}
    
function doSubmit()
{
    strUserTitle = document.getElementById("txtUserName").value;
    if(strUserTitle == "")
    {
        $.messager.alert('提示', "用户名不能为空", 'info');
      return false;
    }
    strUserPWD = document.getElementById("txtUserPWD").value;
    if(strUserPWD == "")
    {
        $.messager.alert('提示', "密码不能为空", 'info');
      return false;
    }
   
    $.messager.progress({
        title: '登录',
        msg: '正在登录中请等待...'
    });
    
    requestAjax('Controller.aspx?controller=LoggingController&method=Login', {txtUserName:$('#txtUserName').val(),txtUserPWD:$('#txtUserPWD').val(),txtUserIP:$('#txtUserIP').val(),txtMac:$('#txtMac').val()}, function(data) {
        $.messager.progress('close');
        window.location.href='login.aspx';
    },function(){$.messager.progress('close');});
    
    return false;
}


window.onload = function() 
{
  document.getElementById("txtMac").value = "";
  document.getElementById("txtUserName").focus();
}

</SCRIPT>
<BODY leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<form name="frmMain"  id="frmMain" method="post"  target="_self" onsubmit="return doSubmit()">
<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TR>
    <TD align=middle>
      <TABLE height=70 cellSpacing=0 cellPadding=0 width=600 border=0>
        <TBODY>
        <TR>
          <TD width=324>
      <TABLE   height=288 cellSpacing=0 cellPadding=0 width=600 border=0>
        <TBODY>
        
        <TR>
          <TD style="padding:5px;" align=left width=500 height=238>
          <div class="easyui-panel" title="用户登录" style="background-color:#E0ECFF;" fit="true">
            <TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
              <TBODY>
              <TR>
                <TD width="250px" style="padding:10px"><img src="images/002.jpg" /></TD>
                <TD height=180 valign="center">
                  <TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
                    <TBODY>
                    <TR height=24>
                      <TD width=150 align="right"><SPAN class=Text>用户名：</SPAN>
                      </TD>
                      <TD width=100>
                      <INPUT name="txtUserName" id="txtUserName" maxlength="30" class="easyui-validatebox" onkeydown="javascript: doKeyDown(event); " onfocus="this.select()" value="">
                      </TD>
                      <TD width=480>&nbsp;</TD>
                    </TR>
                    <TR height=24>
                      <TD width=150 align="right"><SPAN class=Text>密&nbsp;&nbsp;码：</SPAN>
                      </TD>
                      <TD width=100><INPUT type="password" name="txtUserPWD" id="txtUserPWD" maxlength="30" class="easyui-validatebox" onkeydown="javascript: doKeyDown(event);" onfocus="this.select()" value="">
             </TD>
                      <TD width=480><INPUT type="hidden" name="txtMac" id="txtMac" value=""/><INPUT type="hidden" id="txtUserIP" name="txtUserIP" value="<% =strUserIP %>"/>
                      </TD>
                  </TR>
          <TR>
                      <TD align="right" colSpan="2"
                        height=30>&nbsp;
                        <input type="submit" name="Submit" id="Submit" class="button" value="登 录" onkeydown="javascript: doKeyDown(event);"> 
                          &nbsp; <input id="Reset1" type="reset" class="button" value="重置" />
                      </TD>
                       <TD width=350>
                           &nbsp;
                       </TD>
                  </TR>                  
                      </TBODY></TABLE>
                      
                      </TD></TR></TBODY></TABLE>
                      </div>
                      </TD></TR></TBODY></TABLE>
      <TABLE height="70" cellSpacing="0" cellPadding="0" width="600" border="0">
        <TBODY>
        <TR>
          <TD width="60" rowspan="2">&nbsp;&nbsp;</TD>
          <TD align="center"
          height="100%">
          <span style="color:#00309C">
              版权所有： 三月工作室 &nbsp;&nbsp; <B>
              版本： <font color="red">V 2.0</font></B></span><BR>
          <span style="color:#9C9A9C">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
          </TD>
        </TR>
         </TBODY>
         </TABLE>
         </TD></TR></TBODY></TABLE>
     </TD>
   </TR>
   </TABLE>
</form>
</BODY>
</html>
